﻿<div class="panel panel-default">
    <div class="panel-heading">标题</div>
    <div class="panel-body">
        @using (Ajax.BeginForm("AjaxTest", "Home",
       new AjaxOptions
       {
           InsertionMode = InsertionMode.Replace,//Ajax插入模式
           HttpMethod = "Get",//Http请求
           OnFailure = "Null",//页面更细时候调用的JavaScript方法
           LoadingElementId = "ajax-loader",//加载Ajax函数时候显示的html元素id
           UpdateTargetId = "searchresults",//使用服务器更新DOM对象的Id  
       }))
        {
            <input type="text" name="q" />
            <input type="submit" value="search" />
            <img src="@Url.Content("~/Content/Images/CSRF攻击.png")" alt="Text"
                 style="display:none" />
        }
    </div>
    <div class="panel-body">
        <p>
            @Html.LabelFor(model => model.Title);
            @Html.TextBoxFor(model => model.Title);
            @Html.ValidationMessageFor(model => model.Title);
        </p>
    </div>
    <div id="searchresults"></div>
</div>
<script>
    $("#searchresults").html("Search Faileds");
</script>
